<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        {{msg}}
        {{reverseString}}
        <p>只要被计算的字段数值改变，就会触发计算属性</p>
    </div>
</body>
<script src="js/vue.js"></script>
<script>
    // vue 实现自定义指令名字为focus
    Vue.directive('color',{
        // inserted 是固定写法
        bind:function(el,binding){
            // el 代表的是指令所绑定的元素
            // console.log(binding.value)
            el.style.backgroundColor = binding.value
        }
    })

    var vm = new Vue({
        el:'#app',
        data:{
            msg:'orange',
        },
        computed: {
            reverseString:function(){
                return this.msg.split('').reverse().join('')
            }
        },
        methods: {
            handle:function(){

            }
        },
    })

</script>
</html>